﻿@model Company
@{
    var listnews = ViewData["ListNews"] as List<News>;
    var listlibrary = ViewData["ListLibrary"] as List<Library>;
}
<script type="text/javascript">
    $(document).ready(function () {
        
        $('.focuspoint').focusPoint();
    });
</script>
<style>
    .fancybox-opened .fancybox-title {
        font-weight: bold;
        text-align: center;
    }
</style>
<div class="company" style="background:url(@Model.CompanyBackground)  center top no-repeat; background-size: contain ">
    <div class="title" >
        @MvcHtmlString.Create(Model.CompanyBanner)
    </div>  
    <div class="container company-content" >
        <div class="body" style="">
            <div class="header-company col-sm-12">
                <div class="col-sm-2 logo-company">
                    <img src="@Model.CompanyLogo" />
                </div> 
                <div class="col-sm-6 address-company">
                    @MvcHtmlString.Create(Model.CompanyAddress)  
                </div>
                <div class="col-sm-4 contact-company">
                    <div class="col-sm-12 web" ><a href="@Model.CompanyWeb" target="_blank"><h3>@Model.CompanyWeb</h3></a></div>
                    <div class="col-sm-12 phone">@Model.CompanyContact</div>
                    <div class="col-sm-12 icon">
                        <ul >
                            @if(Model.CompanyTwitter !=null)
                            {
                                <li>
                                    <a href="@Model.CompanyTwitter">
                                        <img src="/Images/icon-company-twitter.png"class=""  />
                                    </a>
                                </li>
                            }
                            @if (Model.CompanyFace != null)
                            {
                                <li><a href="@Model.CompanyFace">
                                        <img src="/Images/icon-company-face.png" class=""  />
                                    </a>
                                </li>
                            }
                            @if (Model.CompanyGoogle != null)
                            {
                                <li>
                                    <a href="@Model.CompanyGoogle">
                                        <img src="/Images/icon-company-google.png" class=""  />     
                                    </a>
                                </li>
                            }
                            @if (Model.CompanyYoutube != null)
                            {
                                <li>
                                    <a href="@Model.CompanyYoutube">
                                        <img src="/Images/icon-company-youtube.png" class=""  />   
                                    </a>
                                </li>
                            }
                        </ul>
                    </div>
                </div>
            </div>
            @MvcHtmlString.Create(Model.CompanyBody)  
        </div>
        @if (listnews != null && listnews.Count > 0)
            {
                <div class="list-news">
                    <h2>
                        <a href="@Url.Action("NewsTag", "News", new { id=0,shortname = Model.CompanyShortName, page = 0 })" target="_blank">
                            @("Tin tức".HtmlItemString("navbar", "news"))
                        </a>
                    </h2>
                    <ul>           
                        @foreach (var itemnews in listnews)
                        {
                            <li> <a href="@Url.Action("Detail", "News", new { category = itemnews.NewsCategoryShortName, shortname = itemnews.NewsShortName, newsid = itemnews.NewsId })" target="_blank">
                                     @*<img src="@itemnews.NewsImage"/>*@
                                     <div class="focuspoint img-news-company"
                                          data-focus-x="0"
                                          data-focus-y="0"
                                          data-image-w=""
                                          data-image-h="">
                                         <img src="@itemnews.NewsImage" alt="@itemnews.NewsTitle.SubstringSummary(90)" />
                                     </div>

                                     <h4>@itemnews.NewsPublishDate</h4>
                                     <h3>@itemnews.NewsTitle.SubstringSummary(70)</h3>
                                 </a>
                            </li>
                        }
                    </ul>
                </div>
            }
        @if (listlibrary != null && listlibrary.Count > 0)
        {
            <div class="list-library">
                <h2>
                    <a href="@Url.Action("Index", "Library", new { shortname = Model.CompanyShortName,page=0 })" target="_blank">
                        @("Thư viện".HtmlItemString("navbar", "library"))
                    </a>
                </h2>
                <ul>
                    @foreach (var itemlibrary in listlibrary)
                    {
                        <li class="itemvideo col-xs-6 no-padding">
                             @if (itemlibrary.IsVideo)
                             {
                                 if (!String.IsNullOrEmpty(itemlibrary.LibraryUrl))
                                 {
                                     System.Text.RegularExpressions.Regex YoutubeVideoRegex =
                                         new System.Text.RegularExpressions.Regex(@"youtu(?:\.be|be\.com)/(?:.*v(?:/|=)|(?:.*/)?)([a-zA-Z0-9-_]+)", System.Text.RegularExpressions.RegexOptions.IgnoreCase);
                                     System.Text.RegularExpressions.Match youtubeMatch = YoutubeVideoRegex.Match(itemlibrary.LibraryUrl);
                                     if (youtubeMatch.Success)
                                     {
                                         var id = youtubeMatch.Groups[1].Value;
                                         <a class="various fancybox.iframe" rel="fancybox" href="https://www.youtube.com/v/@id?fs=1&amp;autoplay=1">
                                             <img  id="@id" src="https://i.ytimg.com/vi/@id/mqdefault.jpg" />
                                             <img class="background-video" src="/Images/background-video.png" />
                                                 <h4>@itemlibrary.CreateDate</h4>
                                                 <h3>@itemlibrary.LibraryTitle.SubstringSummary(30)</h3>                                                        
                                         </a>

                                     }
                                 }

                             }
                             else
                             {
                                 <a class="various1 fancybox1 fancybox1.iframe" rel="fancybox1" href="@itemlibrary.LibraryUrl" title="@itemlibrary.LibraryDescription">
                                     <img src="@itemlibrary.LibraryUrl" />
                                     <h4>@itemlibrary.CreateDate</h4>
                                     <h3>@itemlibrary.LibraryTitle.SubstringSummary(30)</h3>         
                                 </a>                              
                             }

                        </li>
                    }
                </ul>
            </div>
        }          
        <div class="col-sm-6 col-md-12" style="padding: 0">
            <div class="breadcrumbs" id="breadcrumbs">
                <ul class="breadcrumb">
                    <li>
                        
                        <a href="@Url.Action("index", "home")">
                            <i class="ace-icon fa fa-home fa-lg home-icon"></i>
                        </a>
                    </li>
                    <li><a href="@Url.Action("Index","Company")">@("Đơn vị thành viên".HtmlItemString("navbar", "companycate"))</a></li>
                    <li class="active">@Model.CompanyName.SubstringSummary(40)</li>
                </ul>      
            </div>
        </div>
    </div>
</div>
<script>
    $(document).ready(function () {
        $('.fancybox1').fancybox();
        $(".various1").fancybox({
            maxWidth: 800,
            maxHeight: 500,
            fitToView: false,
            width: '70%',
            height: '70%',
            autoSize: false,
            closeClick: false,
            openEffect: 'elastic',
            closeEffect: 'none',
            helpers: {
                title: { type: 'inside' },
                buttons: {}
            }

        });
    });
</script>

<script>
    $(document).ready(function () {
        $('.fancybox').fancybox();
        $(".various").fancybox({
            maxWidth: 800,
            maxHeight: 600,
            fitToView: false,
            width: '70%',
            height: '70%',
            autoSize: false,
            closeClick: false,
            openEffect: 'elastic',
            closeEffect: 'none',
            helpers: {
                media: {}
            }
        });
    });
</script>